package app.mvp.contract;


import android.content.Context;

import java.io.Serializable;
import java.util.HashMap;

import app.mvp.base_mvp.BaseModel;
import app.mvp.utils.CookieUtil;
import http.CallBack;
import manager.HttpManager;

/**
 * Created by 刘智强 on 2017/5/3.
 */

public class LoginModel extends BaseModel<LoginModel> implements Serializable {
    /**
     * pcapital : 0
     * birthday : 0
     * sex : 0
     * app_login_key : 8bbdfa226bb463e14475a5f2df2ed299
     * is_auth : 0
     * is_avatar : 0
     * to_user_count : 0
     * parent : 1
     * avatar : http://img.bbqb.cc/avatar/default/avatar1.png
     * is_perfect : 1
     * nick : 小宝
     * is_deposit : 0
     * ID :
     * invite_code : 28352341
     * issetPaypwd : 0
     * is_charge : 0
     * user_id : 973631
     * is_autonym : 0
     * locked : 0
     * phase : 1
     * telephone : 15828352341
     */

    private String pcapital;
    private String birthday;
    private String sex;
    private String app_login_key;
    private String is_auth;
    private String is_avatar;
    private String to_user_count;
    private String parent;
    private String avatar;
    private String is_perfect;
    private String nick;
    private String is_deposit;
    private String ID;
    private String invite_code;
    private String issetPaypwd;
    private String is_charge;
    private String user_id;
    private String is_autonym;
    private String locked;
    private String phase;
    private String telephone;

    public String getPcapital() {
        return pcapital;
    }

    public void setPcapital(String pcapital) {
        this.pcapital = pcapital;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getIssetPaypwd() {
        return issetPaypwd;
    }

    public void setIssetPaypwd(String issetPaypwd) {
        this.issetPaypwd = issetPaypwd;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getApp_login_key() {
        return app_login_key;
    }

    public void setApp_login_key(String app_login_key) {
        this.app_login_key = app_login_key;
    }

    public String getIs_auth() {
        return is_auth;
    }

    public void setIs_auth(String is_auth) {
        this.is_auth = is_auth;
    }

    public String getIs_avatar() {
        return is_avatar;
    }

    public void setIs_avatar(String is_avatar) {
        this.is_avatar = is_avatar;
    }

    public String getTo_user_count() {
        return to_user_count;
    }

    public void setTo_user_count(String to_user_count) {
        this.to_user_count = to_user_count;
    }

    public String getParent() {
        return parent;
    }

    public void setParent(String parent) {
        this.parent = parent;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getIs_perfect() {
        return is_perfect;
    }

    public void setIs_perfect(String is_perfect) {
        this.is_perfect = is_perfect;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getIs_deposit() {
        return is_deposit;
    }

    public void setIs_deposit(String is_deposit) {
        this.is_deposit = is_deposit;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public String getInvite_code() {
        return invite_code;
    }

    public void setInvite_code(String invite_code) {
        this.invite_code = invite_code;
    }

    public String getIs_charge() {
        return is_charge;
    }

    public void setIs_charge(String is_charge) {
        this.is_charge = is_charge;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getIs_autonym() {
        return is_autonym;
    }

    public void setIs_autonym(String is_autonym) {
        this.is_autonym = is_autonym;
    }

    public String getLocked() {
        return locked;
    }

    public void setLocked(String locked) {
        this.locked = locked;
    }

    public String getPhase() {
        return phase;
    }

    public void setPhase(String phase) {
        this.phase = phase;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Override
    public void getModelFromNet(Context context, boolean isGetDataFromCache, String cacheKey, HashMap map, CallBack callBack) {
        super.getModelFromNet(context, isGetDataFromCache, cacheKey, map, callBack);

        HttpManager.getInstance().post(observable, distribute);
    }


    @Override
    public LoginModel getModelFromCache(Context context, String key) {
        return new CookieUtil(context).getObject(key,LoginModel.class);
    }

    @Override
    public void setCache(Context context, String key, LoginModel loginModel) {
        new CookieUtil(context).putObject(key, loginModel);

    }
}
